<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            function Palindrome(num, head, tail) {
                if (head + 1 > tail + 1) {
                    return num; 
                }
                if (num[head] === num[tail]) {
                    return Palindrome(num, head + 1, tail - 1);
                } else {
                    return false;
                }
            }
            var str1 = "12345";
            var str2 = "12321";
            var str3 = "56789";
            var str4 = "56765";
            var str5 = "333333";
            var str6 = "abcba";
            var str7 = "abcdef";

            var s1 = Palindrome(str1, 0, str1.length-1);
            console.log(s1);
            var s2 = Palindrome(str2, 0, str2.length-1);
            console.log(s2);
            var s3 = Palindrome(str3, 0, str3.length-1);
            console.log(s3);
            var s4 = Palindrome(str4, 0, str4.length-1);
            console.log(s4);
            var s5 = Palindrome(str5, 0, str5.length-1);
            console.log(s5);
            var s6 = Palindrome(str6, 0, str6.length-1);
            console.log(s6);
            var s7 =Palindrome(str7, 0, str7.length-1);
            console.log(s7);
        </script>
    </body>
</html>
